<?php
    include 'base.php';

    // $pagenum = 1;
    // $pagesize = 10;
    
    $pagenum = $_GET['pagenum'];
    $pagesize = $_GET['pagesize'];
    $start = ($pagenum - 1) * $pagesize;

    // $sql = "SELECT * FROM `oulelist` LIMIT $start, $pagesize";
    $sql = 'SELECT * FROM `oulelist` ORDER BY `sales` ASC';
    $res = $conn->query($sql);

    $arr = Array();

    while ($row = mysqli_fetch_assoc($res)) {
        array_push($arr, $row);
    }

    echo json_encode($arr);
?>